package com.xing.controller;

import com.xing.Utils.Result;
import com.xing.dto.LiveTagDTO;
import com.xing.service.LiveRoomTagService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Tag(name = "房间标签管理")
@RestController
@RequestMapping(value = "/roomTag")
public class LiveRoomTagController {

    @Autowired
    private LiveRoomTagService liveRoomTagService;


    @Operation(summary = "根据房间id获取房间标签")
    @GetMapping(value = "/getRoomTagByRoomId")
    public Result getRoomTagByRoomId(@RequestParam Long roomId) {
        List<String> roomTagList = liveRoomTagService. getRoomTagByRoomId(roomId);
        return new Result().ok(roomTagList);
    }

    @Operation(summary = "根据房间id获取房间标签对象")
    @GetMapping(value = "/getRoomTagByRoomDTOId")
    public Result getRoomTagByRoomDTOId(@RequestParam Long roomId) {
        List<LiveTagDTO> roomTagList = liveRoomTagService. getRoomTagByRoomDTOId(roomId);
        return new Result().ok(roomTagList);
    }


    @Operation(summary = "修改房间标签")
    @PutMapping("UpdateRoomTag")
    public Result updateRoomTag(@RequestBody List<LiveTagDTO> list){
        System.out.println("打印=="+list);
        liveRoomTagService.updateRoomTag(list);
        return new Result().ok();
    }


}
